#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 15;

int n, m;
struct Node {
  int x, y;
} a[N];
bool check(int x, int y) {
  // check two kings
  if (a[3].x != x || a[3].y != y) {
    if (abs(a[3].x - x) <= 1 && abs(a[3].y - y) <= 1) return true;
  }
  rep(i, 1, 2) {
    int x0 = a[i].x, y0 = a[i].y;
    if (x0 != x || y0 != y) {
      if (x0 == x) {
        if (a[3].x != x) return true;
        int ymn = min(y0, y), ymx = max(y0, y);
        if (a[3].y <= ymn || a[3].y >= ymx) return true;
      }
      if (y0 == y) {
        if (a[3].y != y) return true;
        int xmn = min(x0, x), xmx = max(x0, x);
        if (a[3].x <= xmn || a[3].x >= xmx) return true;
      }
    }
  }
  return false;
}
void solve() {
  rep(i, 1, 4) {
    char c;
    cin >> c;
    a[i].x = c - 'a' + 1;
    cin >> c;
    a[i].y = c - '0';
  }
  rep(dx, -1, 1) rep(dy, -1, 1) {
    int x = a[4].x + dx, y = a[4].y + dy;
    if (x < 1 || x > 8) continue;
    if (y < 1 || y > 8) continue;
    if (!check(x, y)) {
      cout << "OTHER";
      return;
    }
  }
  cout << "CHECKMATE";
  return;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}